package com.cqq.auth.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cqq.auth.dao.UserDao;
import com.cqq.auth.dao.domain.User;
import com.cqq.auth.dao.mapper.UserMapper;
import com.cqq.common.core.base.BaseDao;
import com.cqq.common.core.base.BaseQuery;

/**
 * <h3>用户信息Dao接口实现类</h3>
 * 
 * @author xijq
 * @version 1.0.0
 * 
 */
@Repository("userDao")
public class UserDaoImpl extends BaseDao implements UserDao {
	
	@Autowired
	private UserMapper userMapper;

	
	public void add(User obj) {
		userMapper.add(obj);
	}

	
	public Integer delete(Serializable id) {
		return userMapper.delete(id);
	}

	
	public Integer update(User obj) {
		return userMapper.update(obj);
	}

	
	public User queryById(Serializable id) {
		return userMapper.queryById(id);
	}

	
	public List<User> queryAll() {
		return userMapper.queryAll();
	}

	
	public List<User> queryPage(BaseQuery query) {
		return userMapper.queryPage(query);
	}

	
	public Integer queryCount(BaseQuery query) {
		return userMapper.queryCount(query);
	}

	
	public void updateStatus(Integer id, Integer status) {
		userMapper.updateStatus(id, status);
	}

	
	public User queryByUsername(String username) {
		return userMapper.queryByUsername(username);
	}

	
	public void updateRoleIds(Integer id, Integer[] roleIds) {
		userMapper.updateRoleIds(id, roleIds);
	}

	
	public List<User> queryByIds(Integer[] ids) {
		return userMapper.queryByIds(ids);
	}

	
	public void updateOrgIds(Integer id, Integer[] orgIds) {
		userMapper.updateOrgIds(id, orgIds);
	}

	
	public void updatePassword(Integer id, String password) {
		userMapper.updatePassword(id, password);
	}

	
	public List<User> queryUserByParentOrgId(Integer parentId,String realName) {
		return userMapper.queryUserByParentOrgId(parentId,realName);
	}

	
	public List<User> listUserByOrgId(Integer[] orgIds) {
		return userMapper.listUserByOrgId(orgIds);
	}

	
	public void updateUserUserGroup(Integer userId, Integer[] userGroupIds) {
		userMapper.updateUserUserGroup(userId, userGroupIds);
	}

	
	public List<User> queryUserByParentOrgIdandStatus(Integer parentId,
			String realName, Integer status) {
		return userMapper.queryUserByParentOrgIdandStatus(parentId, realName, status);
	}

	
	public List<User> listUserByOrgIdAndStatus(Integer[] orgids, Integer status) {
		return userMapper.listUserByOrgIdAndStatus(orgids, status);
	}

	
	public List<User> queryByName(String name) {
		return userMapper.queryByName(name);
	}
	
}
